package com.jiang.controller;

import com.jiang.jopo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author jiangjingbo
 * @version V1.0
 * @Project java2203
 * @Package com.jiang.controller
 * @Description:
 * @Date 2022/6/8 15:09
 */
@Controller
@RequestMapping("/json")
public class Jsoncontroller {

    @RequestMapping("/aaaa")
    public  String test1(){
        System.out.println("==========test1");
        return "jsonDemo";
    }

    @RequestMapping("/test1")
    //将java对象转换为json对象发送到jsp页面
    @ResponseBody
//    requestBody 将json对象转换为 java对象
    public  User  testjson(@RequestBody User user ){
        System.out.println("json" + user);
        return user;
    }

    @RequestMapping("/test2")
    @ResponseBody
    public User testFastjson (@RequestBody  User user){
        System.out.println("访问fastJson配置");
        return user;
    }
}
